<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: ExtDirect::Api
  
    &mdash; Documentation by YARD 0.7.3
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '..';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (A)</a> &raquo; 
    <span class='title'><span class='object_link'><a href="../ExtDirect.html" title="ExtDirect (module)">ExtDirect</a></span></span>
     &raquo; 
    <span class="title">Api</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: ExtDirect::Api
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ExtDirect::Api</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/ext_direct/api.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>
Simply expose a class
</p>


  </div>
</div>
<div class="tags">
  
<h3>Author:</h3>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><p>
Mehmet Celik
</p>
</div>
      
    </li>
  
</ul>

</div>

  <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#exposed_api-instance_method" title="#exposed_api (instance method)">- (Object) <strong>exposed_api</strong> </a>
    

    
  </span>
  
  
    <span class="note title readonly">readonly</span>
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
Returns the value of attribute exposed_api.
</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#expose-class_method" title="expose (class method)">+ (Hash) <strong>expose</strong>(class_to_expose, options = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
Expose a class.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#expose_all-class_method" title="expose_all (class method)">+ (Object) <strong>expose_all</strong>(class_dir) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
Expose all classes in a directory(conviniance method).
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_json-class_method" title="to_json (class method)">+ (String) <strong>to_json</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
Return all exposed classes as a JSON String.
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#to_raw-class_method" title="to_raw (class method)">+ (Hash) <strong>to_raw</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
Return a Hash of all exposed classes.
</p>
</div></span>
  
</li>

      
    </ul>
  


  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <span id="exposed_api-instance_method"></span>
      <div class="method_details first">
  <p class="signature first" id="exposed_api-instance_method">
  
    - (<tt>Object</tt>) <strong>exposed_api</strong>  <span class="extras">(readonly)</span>
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
Returns the value of attribute exposed_api
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


7
8
9</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/ext_direct/api.rb', line 7</span>

<span class='kw'>def</span> <span class='id exposed_api'>exposed_api</span>
  <span class='ivar'>@exposed_api</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="expose-class_method">
  
    + (<tt>Hash</tt>) <strong>expose</strong>(class_to_expose, options = {}) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
Expose a class
</p>


  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='name'>class</span>
      
      
        <span class='type'>(<tt>Class</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>
that needs to be exposed
</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>instructions</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>
to how to expose the class. For now just the &#8217;:only&#8217; key is
accepted.
</p>
</div>
      
    </li>
  
</ul>

<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>
returns a list of exposed classes
</p>
</div>
      
    </li>
  
</ul>
<h3>Author:</h3>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><p>
Mehmet Celik
</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/ext_direct/api.rb', line 15</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id expose'>expose</span><span class='lparen'>(</span><span class='id class_to_expose'>class_to_expose</span><span class='comma'>,</span> <span class='id options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='ivar'>@exposed_api</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='ivar'>@exposed_api</span><span class='period'>.</span><span class='id nil?'>nil?</span>
  
  <span class='id methods'>methods</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
  
  <span class='kw'>if</span> <span class='id options'>options</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='symbol'>:only</span><span class='rparen'>)</span>
    <span class='id raw_methods'>raw_methods</span> <span class='op'>=</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:only</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
  <span class='kw'>else</span>
    <span class='id raw_methods'>raw_methods</span> <span class='op'>=</span> <span class='id class_to_expose'>class_to_expose</span><span class='period'>.</span><span class='id instance_methods'>instance_methods</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:except</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
  
  <span class='id raw_methods'>raw_methods</span><span class='period'>.</span><span class='id uniq!'>uniq!</span>
  <span class='id raw_methods'>raw_methods</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id m'>m</span><span class='op'>|</span>
    <span class='id name'>name</span> <span class='op'>=</span> <span class='id m'>m</span>
    <span class='id len'>len</span> <span class='op'>=</span> <span class='id class_to_expose'>class_to_expose</span><span class='period'>.</span><span class='id instance_method'>instance_method</span><span class='lparen'>(</span><span class='id m'>m</span><span class='rparen'>)</span><span class='period'>.</span><span class='id parameters'>parameters</span><span class='period'>.</span><span class='id size'>size</span>
    <span class='id methods'>methods</span> <span class='op'>&lt;&lt;</span> <span class='lbrace'>{</span><span class='symbol'>:name</span> <span class='op'>=&gt;</span> <span class='id name'>name</span><span class='comma'>,</span> <span class='symbol'>:len</span> <span class='op'>=&gt;</span> <span class='id len'>len</span><span class='rbrace'>}</span>
  <span class='kw'>end</span>
        
  <span class='ivar'>@exposed_api</span><span class='period'>.</span><span class='id store'>store</span><span class='lparen'>(</span><span class='id class_to_expose'>class_to_expose</span><span class='period'>.</span><span class='id name'>name</span><span class='comma'>,</span> <span class='id methods'>methods</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="expose_all-class_method">
  
    + (<tt>Object</tt>) <strong>expose_all</strong>(class_dir) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
Expose all classes in a directory(conviniance method)
</p>


  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='name'>Directory</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>
where all classes are stored
</p>
</div>
      
    </li>
  
</ul>

<h3>Author:</h3>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><p>
Mehmet Celik
</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


40
41
42
43
44
45
46
47
48
49
50
51</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/ext_direct/api.rb', line 40</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id expose_all'>expose_all</span><span class='lparen'>(</span><span class='id class_dir'>class_dir</span><span class='rparen'>)</span>
  <span class='ivar'>@exposed_api</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
 
  <span class='const'>Dir</span><span class='period'>.</span><span class='id glob'>glob</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id class_dir'>class_dir</span><span class='rbrace'>}</span><span class='tstring_content'>/**/*.rb</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id r'>r</span><span class='op'>|</span>
    <span class='id rr'>rr</span> <span class='op'>=</span> <span class='id r'>r</span><span class='period'>.</span><span class='id split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id class_dir'>class_dir</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.rb</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>     
    <span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id class_dir'>class_dir</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id rr'>rr</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
    <span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id class_dir'>class_dir</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id rr'>rr</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
 
    <span class='id klass'>klass</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id class'>class</span><span class='period'>.</span><span class='id const_get'>const_get</span><span class='lparen'>(</span><span class='id rr'>rr</span><span class='period'>.</span><span class='id split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id c'>c</span><span class='op'>|</span> <span class='id c'>c</span><span class='period'>.</span><span class='id capitalize'>capitalize</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
    <span class='kw'>self</span><span class='period'>.</span><span class='id expose'>expose</span> <span class='id klass'>klass</span>
  <span class='kw'>end</span>      
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="to_json-class_method">
  
    + (<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>) <strong>to_json</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
Return all exposed classes as a JSON String
</p>


  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>
exposed classes as JSON String
</p>
</div>
      
    </li>
  
</ul>
<h3>Author:</h3>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><p>
Mehmet Celik
</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


57
58
59
60</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/ext_direct/api.rb', line 57</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id to_json'>to_json</span>      
  <span class='id api'>api</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id to_raw'>to_raw</span>
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>REMOTING_API = </span><span class='embexpr_beg'>#{</span><span class='id api'>api</span><span class='period'>.</span><span class='id to_json'>to_json</span><span class='rbrace'>}</span><span class='tstring_content'>;</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="to_raw-class_method">
  
    + (<tt>Hash</tt>) <strong>to_raw</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
Return a Hash of all exposed classes
</p>


  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>
exposed classes
</p>
</div>
      
    </li>
  
</ul>
<h3>Author:</h3>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><p>
Mehmet Celik
</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


66
67
68
69
70</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/ext_direct/api.rb', line 66</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id to_raw'>to_raw</span>
  <span class='id api'>api</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:url</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/router</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> 
         <span class='symbol'>:type</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>remoting</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
         <span class='symbol'>:actions</span> <span class='op'>=&gt;</span> <span class='ivar'>@exposed_api</span><span class='rbrace'>}</span>      
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Sun Oct 23 21:07:37 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.9.2).
</div>

  </body>
</html>